{% extends "RegardNewsBundle::layout.html.twig" %}

{% block title %}Actualit&eacute;s parfumerie Regard Marseille 4&egrave;me{% endblock %}

{% block content %}

<div id="NEWS">
	
    <div>
        {% if is_granted('ROLE_ADMIN') %}
            <a href="{{ path('regard_news_add') }}">Ajouter une news</a>
        {% endif %}
    </div>
          
	<div id="notice">
		{% for flashMessage in app.session.flashbag.get('notice') %}
			{{ flashMessage }}
		{% endfor %}
	</div>
	<br />
	
    {% for news in newsList %}
		<div class="div_news">
			<div class="div_image">
				<img src="{{ asset('img/content/'~news.image) }}" title="{{ news.title }}" alt="{{ news.title }}"/>
				{# <img src="{{ asset('img/produits/'~product.picture) }}" title="{{ product.name }}" alt="{{ product.name }}"/> #}
			</div>
			<div class="div_news_text">
				<div class="div_title">
					<span class="news_title">
						<a href="{{ path('regard_news_show', 
										{'newsId': news.id, 'newsTitle': news.title|replace({' ': "-"})}) }}"
										style="">
							{{ news.title }}
						</a>
					</span>
					<span class="news_date">
						&nbsp;(Ajout&eacute; le {{ news.date|date('d.m.Y') }})
					</span>
					<span class="news_link">
					{% if is_granted('ROLE_ADMIN') %}
						<span>
							&nbsp;<a href="{{ path('regard_news_edit', {'newsId': news.id}) }}">Modifier</a>
						</span>
						<span>
							&nbsp;&#124;&nbsp;
						</span>
						<span>
							&nbsp;<a href="{{ path('regard_news_delete', {'newsId': news.id}) }}">Supprimer</a>
						</span>
					{% endif %}
					</span>
				</div>
				<div class="div_description">
					<span>
						{{ news.content|truncate(400, true, '...') }}
					</span>
				</div>
				<div class="news_link">
					<a href="{{ path('regard_news_show', 
									{'newsId': news.id, 'newsTitle': news.title|replace({' ': "-"})}) }}">
						> En savoir plus
					</a>
				</div>
			</div>
		</div>
    {% endfor %}
	&nbsp;<a href="{{ path('regard_news_list', {'all': "all"}) }}">> Voir plus d'actualit&eacute;s</a>
</div>

{% endblock %}
